package com.lanou.lenanapp.activity;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;

import com.lanou.lenanapp.R;
import com.lanou.lenanapp.adapter.CollectTypeAdapter;


/**
 * Created by dllo on 15/10/24.
 * 收藏界面
 */
public class CollectActivity extends AppCompatActivity implements View.OnClickListener {

    private ImageView back_collect;
    private TabLayout tabLayout;
    private ViewPager viewPager;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_collect);

        init();
        initData();

    }

    private void initData() {
        //管理者
        CollectTypeAdapter adapter = new CollectTypeAdapter(getSupportFragmentManager());
        viewPager.setAdapter(adapter);
        //TabLaout与viewpager进行绑定
        tabLayout.setupWithViewPager(viewPager);

    }

    private void init() {
        back_collect = (ImageView) findViewById(R.id.back_collect);
        back_collect.setOnClickListener(this);
        tabLayout = (TabLayout) findViewById(R.id.tabLayout);
        viewPager = (ViewPager) findViewById(R.id.viewPager);
        //设置下划线的颜色
        tabLayout.setSelectedTabIndicatorColor(0xff66ff00);
//        //设置可滑动模式(按钮多的时候)
//        tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.back_collect:
                finish();
                break;

        }
    }



}
